Fix create_plotting_grid behavior for single plots#428
Open
sanjiti-gill wants to merge 3 commits intoarviz-devs:mainfrom
Open
Fix create_plotting_grid behavior for single plots#428sanjiti-gill wants to merge 3 commits intoarviz-devs:mainfrom
sanjiti-gill wants to merge 3 commits intoarviz-devs:mainfrom
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes inconsistent behavior of create_plotting_grid when generating a single plot.
When squeeze=True (default) and number=1, the plots structure can collapse into a scalar due to NumPy's squeeze behavior. This leads to inconsistent return types compared to multi-plot cases and can cause downstream issues when array-like behavior is expected.
This patch ensures that the single-plot case preserves a consistent 2D structure by wrapping 0D outputs back into a 1×1 array.
Context:
This relates to earlier discussion in #77 where maintainers suspected incorrect behavior for (1,1) grids. This PR localizes the fix to a minimal post-squeeze guard without altering existing API behavior.
Changes:
-Detect 0D output after squeeze
-Wrap into a 1×1 object array to preserve structure consistency
Closes #87